<template>
  <div class="home">
    <!-- <bread-crumb :module="module" :getRouterPath="getRouterPath" :rootRouterPath="rootRouterPath"></bread-crumb>
    <data-list :columns="columns" :module="module"></data-list> -->
    首页
  </div>
</template>

<script>
// @ is an alias to /src
import DataList from '@/components/DataList.vue'
import BreadCrumb from '@/components/BreadCrumb.vue'

export default {
  name: 'home',
  data () {
    return {
      module: 'organization',
      rootRouterPath: '/setting/organization',
      columns: [
        {
          type: 'selection',
          width: 60,
          align: 'center'
        },
        {
          title: '名称',
          key: 'name'
        },
        {
          title: '地址',
          key: 'address'
        },
        {
          title: '操作',
          key: 'action',
          align: 'center',
          render: (h, params) => {
            return h('div', [
              h('Button', {
                props: {
                  type: 'info',
                  size: 'small'
                },
                style: {
                  marginRight: '5px'
                },
                on: {
                  click: () => {
                    this.findChildren(params.index)
                  }
                }
              }, '子机构')
            ])
          }
        }
      ]
    }
  },
  methods: {
    getRouterPath (id) {
      return `/setting/organizations/${id}/children`
    },
    findChildren (index) {
      this.$store.dispatch(`${this.module}/setCurNode`, index)
    }
  },
  components: {
    DataList,
    BreadCrumb
  }
}
</script>
